NOTE: PROCEDURE PRINTTO used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

3    
4    DM "log; clear; ";
5    DM 'odsresults; clear';
6    options noserror;
7    
8    %global projectrootdirectory;
9    %let projectrootdirectory=C:/Users/hpham13/Projects/mf_activism/empirical;
10   
11   *Creates your local Libraries;
12   libname rawdata "&projectrootdirectory./0_input/original";
NOTE: Libref RAWDATA was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\Projects\mf_activism\empirical\0_input\original
13   libname rawdata2 "&projectrootdirectory./0_input/original/finaldatadepvars";
NOTE: Libref RAWDATA2 was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: 
      C:\Users\hpham13\Projects\mf_activism\empirical\0_input\original\finaldatadepvars
14   libname save "&projectrootdirectory./0_input/final";
NOTE: Libref SAVE was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\Projects\mf_activism\empirical\0_input\final
15   
16   %let datadirectory= C:/Users/hpham13/data ;
17   
18   libname lnk "&datadirectory./Linking_tables/";
NOTE: Libref LNK was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\data\Linking_tables
19   libname ceo "&datadirectory./ceo/";
NOTE: Libref CEO was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\data\ceo
20   libname activism "&datadirectory./activism/" ;
NOTE: Libref ACTIVISM was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\data\activism
21   libname comp "&datadirectory./compustat/fundq/";
NOTE: Libref COMP was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\data\compustat\fundq
22   libname compa "&datadirectory./compustat/funda/";
NOTE: Libref COMPA was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\data\compustat\funda
23   libname ibes "&datadirectory./IBES";
NOTE: Libref IBES was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\data\IBES
24   
25   * include some macros;
26   %include "&datadirectory./utils/do_over.sas";
333  %include "&datadirectory./utils/ff48.sas";
405  %include "&datadirectory./utils/ff49.sas";
478  %include "&datadirectory./utils/ff12.sas";
517  %include "&datadirectory./utils/winsorize.sas";
605   %include "&datadirectory./utils/lags.sas";
784   
785   
786   /* ************************************************************************ */
787   /* ***********************  PART 1: IMPORT DATA  ************************** */
788   /* ************************************************************************ */
789   
790   * Import InformedTradeGap variable data;
791   * Uncomment each file name and run separately, need to run 4 times to create 4 samples;
792   
793   * -------------------------------------;
794   * PANEL A of TABLE 10;
795   * -------------------------------------;
796   *%let fname = 020425_aum_p90_1;
797   *%let FFP =
797 ! "C:\Users\hpham13\Projects\mf_activism\empirical\1_code\final_package_acceptance/assembledd
797 ! ata_aum_p90_1.dta";
798   
799   *%let fname = 020425_aum_p95_1;
800   *%let FFP =
800 ! "C:\Users\hpham13\Projects\mf_activism\empirical\1_code\final_package_acceptance/assembledd
800 ! ata_aum_p95_1.dta";
801   
802   * -------------------------------------;
803   * PANEL B of TABLE 10;
804   * -------------------------------------;
805   *%let fname = 020525_aum_p90_2;
806   *%let FFP =
806 ! "C:\Users\hpham13\Projects\mf_activism\empirical\1_code\final_package_acceptance/assembledd
806 ! ata_aum_p90_2.dta";
807   
808   %let fname = 020525_aum_p95_2;
809   %let FFP =
809 ! "C:\Users\hpham13\Projects\mf_activism\empirical\1_code\final_package_acceptance/assembledd
809 ! ata_aum_p95_2.dta";
810   
811   
812   /* ************************************************************************ */
813   /* ************************************************************************ */
814   data stockpick; set rawdata2.stkpick&fname.; run;

NOTE: There were 158618 observations read from the data set RAWDATA2.STKPICK020525_AUM_P95_2.
NOTE: The data set WORK.STOCKPICK has 158618 observations and 35 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds
      

815   
816   /* merge stacked data and others */
817   data stacked_data; set rawdata.stacked_data_111624; run;

NOTE: There were 50730 observations read from the data set RAWDATA.STACKED_DATA_111624.
NOTE: The data set WORK.STACKED_DATA has 50730 observations and 52 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

818   
819   * make the cohort year;
820   data stacked_data; set stacked_data;
821       if qd_rel = 0 then _cohort_y = fyearq; else _cohort_y = 0;
822   run;

NOTE: There were 50730 observations read from the data set WORK.STACKED_DATA.
NOTE: The data set WORK.STACKED_DATA has 50730 observations and 53 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

823   proc sql;
824       create table stacked_data as
825       select *, max(_cohort_y) as cohort_y label='Cohort Year'
826       from stacked_data
827       group by cid ;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.STACKED_DATA created, with 50730 rows and 54 columns.

828   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.05 seconds
      cpu time            0.07 seconds
      

829   data stacked_data; set stacked_data;
830       drop _cohort_y ;
831   run;

NOTE: There were 50730 observations read from the data set WORK.STACKED_DATA.
NOTE: The data set WORK.STACKED_DATA has 50730 observations and 53 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

832   proc sort data=stacked_data; by cid pairid treated qd_rel; run;

NOTE: There were 50730 observations read from the data set WORK.STACKED_DATA.
NOTE: The data set WORK.STACKED_DATA has 50730 observations and 53 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.02 seconds
      cpu time            0.03 seconds
      

833   
834   * activism data;
835   data pilot; set activism.ca_details_95_pilot; run;

NOTE: There were 9262 observations read from the data set ACTIVISM.CA_DETAILS_95_PILOT.
NOTE: The data set WORK.PILOT has 9262 observations and 147 variables.
NOTE: DATA statement used (Total process time):
      real time           0.06 seconds
      cpu time            0.06 seconds
      

836   proc sort data=pilot nodupkey; by  gvkey CAMPAIGN_ID ; run;

NOTE: There were 9262 observations read from the data set WORK.PILOT.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.PILOT has 9262 observations and 147 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.11 seconds
      cpu time            0.11 seconds
      

837   
838   * other activism vars;
839   data sharkwatch;set activism.tohai_activists_12032023;run;

NOTE: There were 3023 observations read from the data set ACTIVISM.TOHAI_ACTIVISTS_12032023.
NOTE: The data set WORK.SHARKWATCH has 3023 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

840   proc sort data=sharkwatch nodupkey; by CAMPAIGN_ID; run;

NOTE: There were 3023 observations read from the data set WORK.SHARKWATCH.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.SHARKWATCH has 3023 observations and 5 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      

841   
842   * Activist prior experience;
843   data activist_prior_exp;set rawdata.activist_prior_exp;run;

NOTE: There were 2110 observations read from the data set RAWDATA.ACTIVIST_PRIOR_EXP.
NOTE: The data set WORK.ACTIVIST_PRIOR_EXP has 2110 observations and 21 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

844   %let qd = (year(ANNOUNCE_DATE)*4  + qtr(ANNOUNCE_DATE) - 1925*4);
845   data activist_prior_exp; set activist_prior_exp ;
846       if ANNOUNCE_DATE ne . then do ;
847           qd = &qd;
848       end;
849   run;

NOTE: There were 2110 observations read from the data set WORK.ACTIVIST_PRIOR_EXP.
NOTE: The data set WORK.ACTIVIST_PRIOR_EXP has 2110 observations and 21 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

850   proc sort data=activist_prior_exp nodupkey; by gvkey year qd; run;

NOTE: There were 2110 observations read from the data set WORK.ACTIVIST_PRIOR_EXP.
NOTE: 227 observations with duplicate key values were deleted.
NOTE: The data set WORK.ACTIVIST_PRIOR_EXP has 1883 observations and 21 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

851   
852   /* Merge data*/
853   proc sql;
854       create table stacked_data2 as
855       select  a.*, b.*, c.*, d.prior_exp,
856               d.mean_prior_exp_sic2, d.med_prior_exp_sic2,
857               d.med_NUMBER_CAMPAIGNS, d.mean_NUMBER_CAMPAIGNS,
858               d.med_ACTIVIST_THREAT_RATING, d.mean_ACTIVIST_THREAT_RATING
859       from    stacked_data as a left join pilot as b
860       on      a.gvkey=b.gvkey and
861               a.FACTSET_ENTITY_ID=b.FACTSET_ENTITY_ID and
862               a.CAMPAIGN_ID=b.CAMPAIGN_ID
863       left join sharkwatch as c
864       on      a.CAMPAIGN_ID=c.CAMPAIGN_ID
865       left join activist_prior_exp as d
866       on      a.gvkey=d.gvkey and a.qd=d.qd ;
WARNING: Variable CAMPAIGN_ID already exists on file WORK.STACKED_DATA2.
WARNING: Variable ANNOUNCE_DATE already exists on file WORK.STACKED_DATA2.
WARNING: Variable FILING_DATE already exists on file WORK.STACKED_DATA2.
WARNING: Variable END_DATE already exists on file WORK.STACKED_DATA2.
WARNING: Variable FACTSET_ENTITY_ID already exists on file WORK.STACKED_DATA2.
WARNING: Variable ENTITY_PROPER_NAME already exists on file WORK.STACKED_DATA2.
WARNING: Variable gvkey already exists on file WORK.STACKED_DATA2.
WARNING: Variable CAMPAIGN_ID already exists on file WORK.STACKED_DATA2.
NOTE: Table WORK.STACKED_DATA2 created, with 50730 rows and 204 columns.

867   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.82 seconds
      cpu time            2.12 seconds
      

868   proc sort data=stacked_data2 nodupkey; by cID PairID treated qd_rel ; run;

NOTE: There were 50730 observations read from the data set WORK.STACKED_DATA2.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.STACKED_DATA2 has 50730 observations and 204 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.96 seconds
      cpu time            0.82 seconds
      

869   
870   * create the SIC2 ;
871   data stacked_data2;
872       set stacked_data2;
873       sic_num = input(sic, 8.);
874       sic2 = floor(sic/100);
875   run;

NOTE: Character values have been converted to numeric values at the places given by: 
      (Line):(Column).
      874:18   
NOTE: There were 50730 observations read from the data set WORK.STACKED_DATA2.
NOTE: The data set WORK.STACKED_DATA2 has 50730 observations and 206 variables.
NOTE: DATA statement used (Total process time):
      real time           0.56 seconds
      cpu time            0.51 seconds
      

876   
877   * count the number of campaigns per sic2-year ;
878   proc sql;
879       create table stacked_data2 as
880       select
881           a.*, b.number_campaigns_ind, b.avg_campaigns_ind, b.med_campaigns_ind,
881 ! b.sd_campaigns_ind,
882           b.med_activist_threat_rating, b.sum_activist_threat_rating,
882 ! b.avg_activist_threat_rating
883       from stacked_data2 as a
884       left join (
885       select distinct CAMPAIGN_ID, sic2, year
886           , sum( number_campaigns) as number_campaigns_ind label="N campaigns (industry)"
887           , mean( number_campaigns) as avg_campaigns_ind format comma8.3
888           , median( number_campaigns) as med_campaigns_ind format comma8.2
889           , std( number_campaigns) as sd_campaigns_ind format comma8.2
890           , median(activist_threat_rating) as med_activist_threat_rating format comma8.2
891           , avg(activist_threat_rating) as avg_activist_threat_rating format comma8.2
892           , sum(activist_threat_rating) as sum_activist_threat_rating format comma8.2
893           from stacked_data2
894           group by sic2, year
895           having number_campaigns ne . and activist_threat_rating ne .
896           ) as b
897       on  a.CAMPAIGN_ID=b.CAMPAIGN_ID and
898           a.sic2=b.sic2 and
899           a.year=b.year  ;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
WARNING: Variable med_activist_threat_rating already exists on file WORK.STACKED_DATA2.
NOTE: Table WORK.STACKED_DATA2 created, with 50730 rows and 212 columns.

900   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           2.20 seconds
      cpu time            2.14 seconds
      

901   
902   
903   /* ************************************************************************ */
904   /* ********************  PART 2: MERGE FUNDQ, FUNDA  ********************** */
905   /* ************************************************************************ */
906   * Merge stacked data and MFF stock picking ability;
907   proc sql;
908       create table Analysis as
909       select  a.*, b.*
910       from    stacked_data2 as a left join stockpick as b
911       on      a.gvkey=b.gvkey and a.rdq=b.rdq ;
WARNING: Variable gvkey already exists on file WORK.ANALYSIS.
WARNING: Variable datadate already exists on file WORK.ANALYSIS.
WARNING: Variable rdq already exists on file WORK.ANALYSIS.
WARNING: Variable qd already exists on file WORK.ANALYSIS.
NOTE: Table WORK.ANALYSIS created, with 50931 rows and 243 columns.

912   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           2.20 seconds
      cpu time            2.03 seconds
      

913   proc sort data=Analysis nodupkey; by cID PairID treated gvkey datadate; run;

NOTE: There were 50931 observations read from the data set WORK.ANALYSIS.
NOTE: 201 observations with duplicate key values were deleted.
NOTE: The data set WORK.ANALYSIS has 50730 observations and 243 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           1.03 seconds
      cpu time            0.98 seconds
      

914   
915   * handle outliers;
916   data Analysis; set Analysis;fyear=year(datadate); run;

NOTE: There were 50730 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.ANALYSIS has 50730 observations and 244 variables.
NOTE: DATA statement used (Total process time):
      real time           0.66 seconds
      cpu time            0.64 seconds
      

917   %winsor(dsetin=work.Analysis, dsetout=work.Analysis, byvar=fyear, vars=relstkpick1 ,
917 ! type=trim, pctl=1 99);

NOTE: There were 50730 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.XTEMP has 50730 observations and 244 variables.
NOTE: DATA statement used (Total process time):
      real time           0.61 seconds
      cpu time            0.60 seconds
      


NOTE: There were 50730 observations read from the data set WORK.XTEMP.
NOTE: The data set WORK.XTEMP has 50730 observations and 244 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           1.08 seconds
      cpu time            1.03 seconds
      

NOTE: Writing HTML Body file: sashtml.htm

NOTE: The data set WORK.XTEMP_PCTL has 28 observations and 3 variables.
NOTE: PROCEDURE UNIVARIATE used (Total process time):
      real time           0.66 seconds
      cpu time            0.50 seconds
      


WARNING: The variable xbyvar in the DROP, KEEP, or RENAME list has never been referenced.
NOTE: There were 50730 observations read from the data set WORK.XTEMP.
NOTE: There were 28 observations read from the data set WORK.XTEMP_PCTL.
NOTE: The data set WORK.ANALYSIS has 50272 observations and 244 variables.
NOTE: DATA statement used (Total process time):
      real time           0.66 seconds
      cpu time            0.65 seconds
      

918   data Analysis; set Analysis;drop fyear ; run;

NOTE: There were 50272 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.ANALYSIS has 50272 observations and 243 variables.
NOTE: DATA statement used (Total process time):
      real time           0.68 seconds
      cpu time            0.62 seconds
      

919   proc sql;
919 !           drop table xtemp, xtemp_pctl;
NOTE: Table WORK.XTEMP has been dropped.
NOTE: Table WORK.XTEMP_PCTL has been dropped.
919 !                                         quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.06 seconds
      cpu time            0.06 seconds
      

920   
921   data fundq_clean;
922       set rawdata.comp_fundq_clean;
923       keep gvkey rdq datadate fyearq fyr fqtr be bd ppegtq PnI saleq to dlttq dlcq
924       oibdpq oiadpq pm ic tacq revq drevq drevadjq ppeq roaq roaq_lag1 me ml bm
925       atq_lag1 saleq_lag1 rectq_lag1 ibq_lag1 size size_l lvrg_l lvrg seqq ltq niq niq_l;
926       if atq > 0 and atq_lag1 > 0 ;
927       size   = log(atq);
928       size_l = log(atq_lag1);
929       lvrg_l = bd/atq_lag1;
930       lvrg   = dlttq/atq;
931       if lvrg eq . then lvrg = 0 ;
932   run;

WARNING: The variable niq_l in the DROP, KEEP, or RENAME list has never been referenced.
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      227702 at 929:16   8651 at 930:19     
NOTE: There were 1125340 observations read from the data set RAWDATA.COMP_FUNDQ_CLEAN.
NOTE: The data set WORK.FUNDQ_CLEAN has 1012247 observations and 39 variables.
NOTE: DATA statement used (Total process time):
      real time           0.47 seconds
      cpu time            0.45 seconds
      

933   proc sort data=fundq_clean nodupkey; by gvkey datadate; run;

NOTE: There were 1012247 observations read from the data set WORK.FUNDQ_CLEAN.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.FUNDQ_CLEAN has 1012247 observations and 39 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.47 seconds
      cpu time            0.53 seconds
      

934   %let winsVars2 = saleq revq ;
935   %winsor(dsetin=work.fundq_clean, dsetout=work.fundq_clean, byvar=fyearq, vars=&winsVars2,
935 ! type=winsor, pctl=1 99);

NOTE: There were 1012247 observations read from the data set WORK.FUNDQ_CLEAN.
NOTE: The data set WORK.XTEMP has 1012247 observations and 39 variables.
NOTE: DATA statement used (Total process time):
      real time           0.20 seconds
      cpu time            0.21 seconds
      


NOTE: There were 1012247 observations read from the data set WORK.XTEMP.
NOTE: The data set WORK.XTEMP has 1012247 observations and 39 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.55 seconds
      cpu time            0.68 seconds
      


NOTE: The data set WORK.XTEMP_PCTL has 30 observations and 5 variables.
NOTE: PROCEDURE UNIVARIATE used (Total process time):
      real time           0.79 seconds
      cpu time            0.73 seconds
      


WARNING: The variable xbyvar in the DROP, KEEP, or RENAME list has never been referenced.
NOTE: There were 1012247 observations read from the data set WORK.XTEMP.
NOTE: There were 30 observations read from the data set WORK.XTEMP_PCTL.
NOTE: The data set WORK.FUNDQ_CLEAN has 1012247 observations and 39 variables.
NOTE: DATA statement used (Total process time):
      real time           0.38 seconds
      cpu time            0.39 seconds
      

936   
937   * more fundq vars;
938   data fundq_add; set comp.fundq_1950_2021;
939       keep gvkey datadate intanq;
940       where datadate>'01JAN1990'd;
941   run;

NOTE: There were 1441077 observations read from the data set COMP.FUNDQ_1950_2021.
      WHERE datadate>'01JAN1990'D;
NOTE: The data set WORK.FUNDQ_ADD has 1441077 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.54 seconds
      cpu time            0.53 seconds
      

942   
943   proc sort data=fundq_add nodupkey; by gvkey datadate; run;

NOTE: There were 1441077 observations read from the data set WORK.FUNDQ_ADD.
NOTE: 1238 observations with duplicate key values were deleted.
NOTE: The data set WORK.FUNDQ_ADD has 1439839 observations and 3 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.15 seconds
      cpu time            0.29 seconds
      

944   proc sort data=fundq_clean nodupkey; by gvkey datadate; run;

NOTE: There were 1012247 observations read from the data set WORK.FUNDQ_CLEAN.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.FUNDQ_CLEAN has 1012247 observations and 39 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.56 seconds
      cpu time            0.65 seconds
      

945   data fundq_clean;
946       merge fundq_clean(in=a) fundq_add (in=b);
947       by gvkey datadate;
948       if a;
949   run;

NOTE: There were 1012247 observations read from the data set WORK.FUNDQ_CLEAN.
NOTE: There were 1439839 observations read from the data set WORK.FUNDQ_ADD.
NOTE: The data set WORK.FUNDQ_CLEAN has 1012247 observations and 40 variables.
NOTE: DATA statement used (Total process time):
      real time           0.28 seconds
      cpu time            0.28 seconds
      

950   
951   * Create calendar date of fiscal period end in Compustat extract;
952   data fundq_clean; set fundq_clean;
953      if (1<=fyr<=5) then date_fyend=intnx('month',mdy(fyr,1,fyearq+1),0,'end');
954      else if (6<=fyr<=12) then date_fyend=intnx('month',mdy(fyr,1,fyearq),0,'end');
955      fqenddt=intnx('month',date_fyend,-3*(4-fqtr),'end');
956      format fqenddt date9.;
957      drop date_fyend;
958   run;

NOTE: There were 1012247 observations read from the data set WORK.FUNDQ_CLEAN.
NOTE: The data set WORK.FUNDQ_CLEAN has 1012247 observations and 41 variables.
NOTE: DATA statement used (Total process time):
      real time           0.93 seconds
      cpu time            0.70 seconds
      

959   
960   * moving sum of quarterly loss;
961   data fundq_clean; set fundq_clean;
962       if niq <0 then lossq = 1 ; else lossq = 0;
963   run;

NOTE: There were 1012247 observations read from the data set WORK.FUNDQ_CLEAN.
NOTE: The data set WORK.FUNDQ_CLEAN has 1012247 observations and 42 variables.
NOTE: DATA statement used (Total process time):
      real time           0.20 seconds
      cpu time            0.20 seconds
      

964   
965   proc sort data=fundq_clean; by gvkey datadate; run;

NOTE: There were 1012247 observations read from the data set WORK.FUNDQ_CLEAN.
NOTE: The data set WORK.FUNDQ_CLEAN has 1012247 observations and 42 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.77 seconds
      cpu time            0.68 seconds
      

966   proc expand data=fundq_clean out=fundq_clean;
967       by gvkey;
968       id datadate;
969       convert lossq = sum_lossq12 / transformout=(movsum 12);
970       convert niq = ma_niq12 / transformout=(movave 12);
971       convert niq = sd_niq12 / transformout=(movstd 12);
972   run;

WARNING: The variable niq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
WARNING: The variable niq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
NOTE: The above message was for the following BY group:
      Global Company Key=009879
WARNING: The variable niq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
WARNING: The variable niq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
NOTE: The above message was for the following BY group:
      Global Company Key=010673
WARNING: The variable niq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
WARNING: The variable niq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
NOTE: The above message was for the following BY group:
      Global Company Key=013260
WARNING: The variable niq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
WARNING: The variable niq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
NOTE: The above message was for the following BY group:
      Global Company Key=013530
WARNING: The variable niq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
WARNING: The variable niq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
NOTE: The above message was for the following BY group:
      Global Company Key=013938
WARNING: The variable niq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
WARNING: The variable niq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
NOTE: The above message was for the following BY group:
      Global Company Key=060976
NOTE: The data set WORK.FUNDQ_CLEAN has 1012247 observations and 45 variables.
NOTE: PROCEDURE EXPAND used (Total process time):
      real time           1.73 seconds
      cpu time            1.70 seconds
      

973   data fundq_clean; set fundq_clean;
974       drop datadate;
975   run;

NOTE: There were 1012247 observations read from the data set WORK.FUNDQ_CLEAN.
NOTE: The data set WORK.FUNDQ_CLEAN has 1012247 observations and 44 variables.
NOTE: DATA statement used (Total process time):
      real time           0.21 seconds
      cpu time            0.20 seconds
      

976   
977   *add funda vars;
978   data funda_clean;
979       set rawdata.comp_funda_clean2020;
980       if at>0 & at_l>0;
981       asize   = log(at);
982       asize_l = log(at_l);
983       bm_ann = bm;
984       where datadate ne . and at>0;
985       label asize = "Log(AT)"
986       asize_l = "Log(AT_l)" ;
987   run;

NOTE: There were 182044 observations read from the data set RAWDATA.COMP_FUNDA_CLEAN2020.
      WHERE (datadate not = .) and (at>0);
NOTE: The data set WORK.FUNDA_CLEAN has 181286 observations and 116 variables.
NOTE: DATA statement used (Total process time):
      real time           0.09 seconds
      cpu time            0.09 seconds
      

988   proc sort data=funda_clean nodupkey ; by gvkey fyear; run;

NOTE: There were 181286 observations read from the data set WORK.FUNDA_CLEAN.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.FUNDA_CLEAN has 181286 observations and 116 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.29 seconds
      cpu time            0.32 seconds
      

989   * additional funda vars;
990   data funda_add; set compa.funda_1950_2021;
991       keep gvkey datadate intan ;
992   run;

NOTE: There were 861623 observations read from the data set COMPA.FUNDA_1950_2021.
NOTE: The data set WORK.FUNDA_ADD has 861623 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.20 seconds
      cpu time            0.18 seconds
      

993   proc sort data=funda_add nodupkey; by gvkey datadate; run;

NOTE: There were 861623 observations read from the data set WORK.FUNDA_ADD.
NOTE: 307572 observations with duplicate key values were deleted.
NOTE: The data set WORK.FUNDA_ADD has 554051 observations and 3 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.12 seconds
      cpu time            0.21 seconds
      

994   data funda_clean;
995       merge funda_clean(in=a) funda_add(in=b);
996       by gvkey datadate;
997       if a;
998   run;

NOTE: There were 181286 observations read from the data set WORK.FUNDA_CLEAN.
NOTE: There were 554051 observations read from the data set WORK.FUNDA_ADD.
NOTE: The data set WORK.FUNDA_CLEAN has 181286 observations and 117 variables.
NOTE: DATA statement used (Total process time):
      real time           0.25 seconds
      cpu time            0.25 seconds
      

999   
1000  * firm age;
1001  data funda_clean ;
1002      set funda_clean;
1003      by gvkey;
1004      if first.gvkey then
1005          firm_age=0;
1006      firm_age + 1;
1007  run;

NOTE: There were 181286 observations read from the data set WORK.FUNDA_CLEAN.
NOTE: The data set WORK.FUNDA_CLEAN has 181286 observations and 118 variables.
NOTE: DATA statement used (Total process time):
      real time           0.11 seconds
      cpu time            0.11 seconds
      

1008  proc sort data=funda_clean; by gvkey fyear;  run;

NOTE: There were 181286 observations read from the data set WORK.FUNDA_CLEAN.
NOTE: The data set WORK.FUNDA_CLEAN has 181286 observations and 118 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.25 seconds
      cpu time            0.26 seconds
      

1009  
1010  * check the mean, median, and standard deviation by industry ;
1011  proc sql;
1012      create table funda_clean as
1013      select *,
1014          mean(firm_age) as ind_mean_firm_age label="Industry mean firm age",
1015          median(firm_age) as ind_med_firm_age label="Industry median firm age",
1016          std(firm_age) as ind_std_firm_age label="Industry Std firm age"
1017      from funda_clean
1018      group by sic2, fyear
1019      order by gvkey, fyear;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.FUNDA_CLEAN created, with 181286 rows and 121 columns.

1020  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.86 seconds
      cpu time            0.84 seconds
      

1021  
1022  data StateName;set rawdata.firmStateName;run;

NOTE: There were 41696 observations read from the data set RAWDATA.FIRMSTATENAME.
NOTE: The data set WORK.STATENAME has 41696 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

1023  
1024  proc sql;
1025      create table Analysis as
1026      select  a.*,b.*,
1027              c.StateName label="Firm HQ State", c.ST label="State",
1028              d.at, d.at_l, d.sale, d.sale_l, d.ni, d.ib, d.ibc,
1029              d.firm_age, d.ind_mean_firm_age, d.ind_std_firm_age, d.ind_med_firm_age,
1030              d.revt, d.revt_l, d.ceq, d.datadate as datadate_ann, d.xrd, d.intan
1031      from    Analysis as a
1032      left join fundq_clean as b
1033          on  a.gvkey=b.gvkey and a.rdq=b.rdq
1034      left join StateName as c
1035          on  a.gvkey=c.gvkey
1036      left join funda_clean as d
1037          on  a.gvkey=d.gvkey and a.fyearq=d.fyear ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
WARNING: Variable gvkey already exists on file WORK.ANALYSIS.
WARNING: Variable fyearq already exists on file WORK.ANALYSIS.
WARNING: Variable fqtr already exists on file WORK.ANALYSIS.
WARNING: Variable fyr already exists on file WORK.ANALYSIS.
WARNING: Variable rdq already exists on file WORK.ANALYSIS.
WARNING: Variable dlcq already exists on file WORK.ANALYSIS.
WARNING: Variable dlttq already exists on file WORK.ANALYSIS.
WARNING: Variable ltq already exists on file WORK.ANALYSIS.
WARNING: Variable niq already exists on file WORK.ANALYSIS.
WARNING: Variable oiadpq already exists on file WORK.ANALYSIS.
WARNING: Variable oibdpq already exists on file WORK.ANALYSIS.
WARNING: Variable ppegtq already exists on file WORK.ANALYSIS.
WARNING: Variable saleq already exists on file WORK.ANALYSIS.
WARNING: Variable me already exists on file WORK.ANALYSIS.
NOTE: Table WORK.ANALYSIS created, with 51070 rows and 292 columns.

1038  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           4.76 seconds
      cpu time            4.82 seconds
      

1039  
1040  proc sql;
1041      create table Analysis as
1042      select *,
1043          max(firm_age) as firm_age2
1044      from Analysis
1045      group by cid, gvkey, year(datadate)
1046      order by cid, pairid, gvkey, rdq;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 51070 rows and 293 columns.

1047  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           3.08 seconds
      cpu time            3.00 seconds
      

1048  
1049  proc sql;
1050      create table Analysis as
1051      select *,
1052          mean(firm_age) as ind_mean_firm_age2 label="Industry mean firm age",
1053          median(firm_age) as ind_med_firm_age2 label="Industry median firm age",
1054          std(firm_age) as ind_std_firm_age2 label="Industry Std firm age"
1055      from Analysis
1056      group by cid, sic2
1057      order by cid, pairid, gvkey, rdq;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 51070 rows and 296 columns.

1058  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           3.15 seconds
      cpu time            2.95 seconds
      

1059  
1060  * check calendar quarter ;
1061  data Analysis; set Analysis;
1062      calyear = year(datadate_ann);
1063      if calyear = . then calyear = year(fqenddt);
1064      calqtr = qtr(datadate);
1065  run;

NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      3562 at 1062:15   127 at 1063:35    
NOTE: There were 51070 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.ANALYSIS has 51070 observations and 298 variables.
NOTE: DATA statement used (Total process time):
      real time           0.63 seconds
      cpu time            0.60 seconds
      

1066  
1067  * compute the average inst ownership over the fiscal year;
1068  proc sql;
1069      create table Analysis as
1070      select *, avg(ior) as avg_ior label="Average Qtr IOR" format comma8.4
1071      from Analysis
1072      group by gvkey, fyearq
1073      order by cid, gvkey, rdq;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 51070 rows and 299 columns.

1074  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           3.23 seconds
      cpu time            3.17 seconds
      

1075  data Analysis;
1076      retain gvkey fyearq fqtr rdq datadate ANNOUNCE_DATE treated post qd_rel cid pairid qd;
1077      set Analysis;
1078      if cmiss (of relstkpick1 ) eq 0;
1079  run;

NOTE: There were 51070 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.ANALYSIS has 23919 observations and 299 variables.
NOTE: DATA statement used (Total process time):
      real time           0.53 seconds
      cpu time            0.50 seconds
      

1080  
1081  
1082  /* ************************************************************************ */
1083  * make some vars to check the number of non-missing Relstkpick ;
1084  /* ************************************************************************ */
1085  * COUNTER is a cummulative number: 0,1,2,3,4,5 ;
1086  proc sort data=Analysis; by cid gvkey post; run;

NOTE: There were 23919 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.ANALYSIS has 23919 observations and 299 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.53 seconds
      cpu time            0.51 seconds
      

1087  data Analysis;
1088      set Analysis;
1089      by cID gvkey post;
1090      if first.post then COUNTER=0;
1091      COUNTER+(Relstkpick1 ne .);
1092  run;

NOTE: There were 23919 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.ANALYSIS has 23919 observations and 300 variables.
NOTE: DATA statement used (Total process time):
      real time           0.33 seconds
      cpu time            0.34 seconds
      

1093  
1094  proc sql;
1095      create table Analysis as
1096      select *,
1097          max(COUNTER) as COUNTER_BY_POST
1098      from Analysis
1099      group by cID, gvkey, post
1100      order by cid, gvkey, qd_rel ;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 23919 rows and 301 columns.

1101  
1102      create table Analysis as
1103      select *,
1104          min(post) as MIN_POST,
1105          max(post) as MAX_POST,
1106          min(COUNTER_BY_POST) as MIN_NOBS_PRE_POST
1107      from Analysis
1108      group by cID, gvkey
1109      order by cid, gvkey, qd_rel ;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 23919 rows and 304 columns.

1110  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           2.72 seconds
      cpu time            2.34 seconds
      

1111  proc sort data=Analysis ; by cID PairID treated gvkey datadate; run;

NOTE: There were 23919 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.ANALYSIS has 23919 observations and 304 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.46 seconds
      cpu time            0.45 seconds
      

1112  proc sort data=Analysis nodupkey; by cID treated gvkey datadate; run;

NOTE: There were 23919 observations read from the data set WORK.ANALYSIS.
NOTE: 391 observations with duplicate key values were deleted.
NOTE: The data set WORK.ANALYSIS has 23528 observations and 304 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.47 seconds
      cpu time            0.45 seconds
      

1113  
1114  * destring SIC;
1115  data Analysis;  set Analysis;   sic_num = input(sic, 8.); label sic_num="Standard Industry
1115! Classification Code"; drop sic; run;

NOTE: There were 23528 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.ANALYSIS has 23528 observations and 303 variables.
NOTE: DATA statement used (Total process time):
      real time           0.31 seconds
      cpu time            0.32 seconds
      

1116  data Analysis;  set Analysis;   rename sic_num = sic; run;

NOTE: There were 23528 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.ANALYSIS has 23528 observations and 303 variables.
NOTE: DATA statement used (Total process time):
      real time           0.32 seconds
      cpu time            0.31 seconds
      

1117  proc sort data=Analysis nodupkey; by cid gvkey datadate; run;

NOTE: There were 23528 observations read from the data set WORK.ANALYSIS.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.ANALYSIS has 23528 observations and 303 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.41 seconds
      cpu time            0.40 seconds
      

1118  
1119  
1120  /* ************************************************************************ */
1121  /* ***********************  PART 3: OTHER DATASET  ************************ */
1122  /* ************************************************************************ */
1123  * Analyst forecast and Analyst following;
1124  data afc; set rawdata.afc_fundq;
1125      keep gvkey fyearq datadate rdq numest lnanalys repdats ryear ;
1126      lnanalys = log(1+numest);
1127      if lnanalys ne . ;
1128      ryear = year(repdats);
1129  run;

NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      480890 at 1126:16   480890 at 1126:21   
NOTE: There were 988699 observations read from the data set RAWDATA.AFC_FUNDQ.
NOTE: The data set WORK.AFC has 507809 observations and 8 variables.
NOTE: DATA statement used (Total process time):
      real time           0.12 seconds
      cpu time            0.12 seconds
      

1130  proc sort data=afc nodupkey ; by gvkey repdats; run;

NOTE: There were 507809 observations read from the data set WORK.AFC.
NOTE: 1183 observations with duplicate key values were deleted.
NOTE: The data set WORK.AFC has 506626 observations and 8 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.06 seconds
      cpu time            0.09 seconds
      

1131  proc sql;
1132      create table afc as
1133      select  distinct gvkey, ryear, datadate,
1134              max(numest) as numest_max label="Max #Analyst (year)",
1135              max(lnanalys) as lnanalys_max label="Max #LnAnalyst (year)"
1136      from    afc
1137      group by gvkey, ryear
1138      order by gvkey, datadate;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.AFC created, with 506626 rows and 5 columns.

1139  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.33 seconds
      cpu time            0.40 seconds
      

1140  
1141  * Stock illiquidity (AIM);
1142  data aim; set rawdata.aim; run;

NOTE: There were 649518 observations read from the data set RAWDATA.AIM.
NOTE: The data set WORK.AIM has 649518 observations and 9 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds
      

1143  proc sort data=aim nodupkey; by gvkey datadate; run;

NOTE: There were 649518 observations read from the data set WORK.AIM.
NOTE: 374 observations with duplicate key values were deleted.
NOTE: The data set WORK.AIM has 649144 observations and 9 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.07 seconds
      cpu time            0.17 seconds
      

1144  
1145  * Price synchronicity (Morck et al 2002);
1146  data psynch ; set rawdata.pinfo_qtr_retx6d; run;

NOTE: There were 515792 observations read from the data set RAWDATA.PINFO_QTR_RETX6D.
NOTE: The data set WORK.PSYNCH has 515792 observations and 9 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds
      

1147  proc sort data=psynch; by gvkey fyear fqtr; run;

NOTE: There were 515792 observations read from the data set WORK.PSYNCH.
NOTE: The data set WORK.PSYNCH has 515792 observations and 9 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.06 seconds
      cpu time            0.12 seconds
      

1148  
1149  data psynch; set psynch;
1150      by gvkey fyear fqtr;
1151      if last.fqtr;
1152  run;

NOTE: There were 515792 observations read from the data set WORK.PSYNCH.
NOTE: The data set WORK.PSYNCH has 515774 observations and 9 variables.
NOTE: DATA statement used (Total process time):
      real time           0.04 seconds
      cpu time            0.04 seconds
      

1153  
1154  * the Bushee's IICLASS data;
1155  data io_class;
1156      set rawdata.io_class2022qtr;
1157      rqtr = qtr(rdate);
1158      ryear = year(rdate);
1159  run;

NOTE: There were 737259 observations read from the data set RAWDATA.IO_CLASS2022QTR.
NOTE: The data set WORK.IO_CLASS has 737259 observations and 13 variables.
NOTE: DATA statement used (Total process time):
      real time           0.13 seconds
      cpu time            0.12 seconds
      

1160  
1161  * Financial constraints;
1162  data constraints; set rawdata.constraints; run;

NOTE: There were 162789 observations read from the data set RAWDATA.CONSTRAINTS.
NOTE: The data set WORK.CONSTRAINTS has 162789 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

1163  
1164  * Opacity;
1165  data AFERR;
1166      set rawdata.AFERR;
1167      fpeyear = year(FPEDATS);
1168      drop fyear;
1169  run;

NOTE: There were 124683 observations read from the data set RAWDATA.AFERR.
NOTE: The data set WORK.AFERR has 124683 observations and 14 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds
      

1170  proc sort data=AFERR nodupkey; by gvkey fpeyear; run;

NOTE: There were 124683 observations read from the data set WORK.AFERR.
NOTE: 14 observations with duplicate key values were deleted.
NOTE: The data set WORK.AFERR has 124669 observations and 14 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds
      

1171  data AFERR; set AFERR; drop fpeyear; run;

NOTE: There were 124669 observations read from the data set WORK.AFERR.
NOTE: The data set WORK.AFERR has 124669 observations and 13 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

1172  
1173  * Ivol quarterly;
1174  data retvol; set rawdata.retvolqtr_112824; run;

NOTE: There were 519328 observations read from the data set RAWDATA.RETVOLQTR_112824.
NOTE: The data set WORK.RETVOL has 519328 observations and 7 variables.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds
      

1175  proc sort data=retvol nodupkey; by gvkey enddt; run;

NOTE: There were 519328 observations read from the data set WORK.RETVOL.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.RETVOL has 519328 observations and 7 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.11 seconds
      cpu time            0.12 seconds
      

1176  
1177  * abnormal trading volume;
1178  data abvolume; set rawdata.abvolume; run;

NOTE: There were 747275 observations read from the data set RAWDATA.ABVOLUME.
NOTE: The data set WORK.ABVOLUME has 747275 observations and 6 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.01 seconds
      

1179  proc sort data=abvolume nodupkey; by gvkey fyearq fqtr; run;

NOTE: There were 747275 observations read from the data set WORK.ABVOLUME.
NOTE: 29080 observations with duplicate key values were deleted.
NOTE: The data set WORK.ABVOLUME has 718195 observations and 6 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.13 seconds
      cpu time            0.21 seconds
      

1180  
1181  * CAR at meeting dates to activism data;
1182  data car_meetingdt1; set rawdata.car_meetingdt_capm_00;
1183      rename car = car_meeting00;
1184      label car = "AR[0] Meeting dt";
1185  run;

NOTE: There were 1826 observations read from the data set RAWDATA.CAR_MEETINGDT_CAPM_00.
NOTE: The data set WORK.CAR_MEETINGDT1 has 1826 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1186  proc sort data=car_meetingdt1 nodupkey; by pairid treated gvkey ANNOUNCE_DATE ; run;

NOTE: There were 1826 observations read from the data set WORK.CAR_MEETINGDT1.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.CAR_MEETINGDT1 has 1826 observations and 10 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1187  
1188  data car_meetingdt2; set rawdata.car_meetingdt_capm_01;
1189      rename car = car_meeting01;
1190      label car = "CAR[0+1] Meeting dt";
1191  run;

NOTE: There were 1826 observations read from the data set RAWDATA.CAR_MEETINGDT_CAPM_01.
NOTE: The data set WORK.CAR_MEETINGDT2 has 1826 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

1192  proc sort data=car_meetingdt2 nodupkey; by pairid treated gvkey ANNOUNCE_DATE ; run;

NOTE: There were 1826 observations read from the data set WORK.CAR_MEETINGDT2.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.CAR_MEETINGDT2 has 1826 observations and 10 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1193  
1194  data car_meetingdt3; set rawdata.car_meetingdt_capm_11_round2;
1195      rename car = car_meeting11;
1196      label car = "CAR[-1+1] Meeting dt";
1197  run;

NOTE: There were 1846 observations read from the data set RAWDATA.CAR_MEETINGDT_CAPM_11_ROUND2.
NOTE: The data set WORK.CAR_MEETINGDT3 has 1846 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1198  proc sort data=car_meetingdt3 nodupkey; by pairid treated gvkey ANNOUNCE_DATE ; run;

NOTE: There were 1846 observations read from the data set WORK.CAR_MEETINGDT3.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.CAR_MEETINGDT3 has 1846 observations and 10 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1199  
1200  data car_meetingdt4; set rawdata.car_meetingdt_capm_17;
1201      rename car = car_meeting17;
1202      label car = "CAR[+1+7] Meeting dt";
1203  run;

NOTE: There were 1826 observations read from the data set RAWDATA.CAR_MEETINGDT_CAPM_17.
NOTE: The data set WORK.CAR_MEETINGDT4 has 1826 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1204  proc sort data=car_meetingdt4 nodupkey; by pairid treated gvkey ANNOUNCE_DATE ; run;

NOTE: There were 1826 observations read from the data set WORK.CAR_MEETINGDT4.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.CAR_MEETINGDT4 has 1826 observations and 10 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1205  
1206  data car_meetingdt5; set rawdata.car_meetingdt_capm_27_round2;
1207      rename car = car_meeting27;
1208      label car = "CAR[+2+7] Meeting dt";
1209  run;

NOTE: There were 1846 observations read from the data set RAWDATA.CAR_MEETINGDT_CAPM_27_ROUND2.
NOTE: The data set WORK.CAR_MEETINGDT5 has 1846 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1210  proc sort data=car_meetingdt5 nodupkey; by pairid treated gvkey ANNOUNCE_DATE ; run;

NOTE: There were 1846 observations read from the data set WORK.CAR_MEETINGDT5.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.CAR_MEETINGDT5 has 1846 observations and 10 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1211  
1212  data car_meetingdt6; set rawdata.car_meetingdt_capm_214;
1213      rename car = car_meeting214;
1214      label car = "CAR[+2+14] Meeting dt";
1215  run;

NOTE: There were 1826 observations read from the data set RAWDATA.CAR_MEETINGDT_CAPM_214.
NOTE: The data set WORK.CAR_MEETINGDT6 has 1826 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1216  proc sort data=car_meetingdt6 nodupkey; by pairid treated gvkey ANNOUNCE_DATE ; run;

NOTE: There were 1826 observations read from the data set WORK.CAR_MEETINGDT6.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.CAR_MEETINGDT6 has 1826 observations and 10 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1217  
1218  * compute the sum of Large and Small MFOR immediately before 13D;
1219  data mfor_13d; set rawdata.mfor_13d;run;

NOTE: There were 856 observations read from the data set RAWDATA.MFOR_13D.
NOTE: The data set WORK.MFOR_13D has 856 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

1220  proc sort data=mfor_13d nodupkey; by gvkey CAMPAIGN_ID; run;

NOTE: There were 856 observations read from the data set WORK.MFOR_13D.
NOTE: 4 observations with duplicate key values were deleted.
NOTE: The data set WORK.MFOR_13D has 852 observations and 10 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1221  
1222  * Investor Relation (IR) data;
1223  data ir; set rawdata.ir2_111624; run;

NOTE: There were 133334 observations read from the data set RAWDATA.IR2_111624.
NOTE: The data set WORK.IR has 133334 observations and 42 variables.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.03 seconds
      

1224  
1225  * experience level of proxy solicitors;
1226  data advisory; set rawdata.advisory; run;

NOTE: There were 9262 observations read from the data set RAWDATA.ADVISORY.
NOTE: The data set WORK.ADVISORY has 9262 observations and 12 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

1227  proc sort data=advisory nodupkey; by CAMPAIGN_ID; run;

NOTE: There were 9262 observations read from the data set WORK.ADVISORY.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.ADVISORY has 9262 observations and 12 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      

1228  
1229  * Insider Ownership;
1230  data insider; set rawdata.insider; run;

NOTE: There were 48632 observations read from the data set RAWDATA.INSIDER.
NOTE: The data set WORK.INSIDER has 48632 observations and 6 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

1231  
1232  * Merge data;
1233  proc sql;
1234  create table Analysis as
1235  select  a.*, b.*
1236  from    Analysis as a left join afc as b
1237  on      a.gvkey=b.gvkey and a.datadate = b.datadate ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
WARNING: Variable gvkey already exists on file WORK.ANALYSIS.
WARNING: Variable ryear already exists on file WORK.ANALYSIS.
WARNING: Variable datadate already exists on file WORK.ANALYSIS.
NOTE: Table WORK.ANALYSIS created, with 23528 rows and 305 columns.

1238  
1239  create table Analysis as
1240  select  a.*, b.insider_own
1241  from    Analysis as a left join insider as b
1242  on      a.gvkey=b.gvkey and a.datadate = b.datadate ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 23528 rows and 306 columns.

1243  
1244  create table Analysis as
1245  select  a.*, b.aim, b.ln_oneplusaim, b.ln_aim
1246  from    Analysis as a left join aim as b
1247  on      a.gvkey=b.gvkey and a.datadate = b.datadate;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 23528 rows and 309 columns.

1248  
1249  create table Analysis as
1250  select  a.*, b.psynch1,b.psynch2,b.psynch3,b.pinfo1,b.pinfo2,b.pinfo3
1251  from    Analysis as a left join psynch as b
1252  on      a.gvkey=b.gvkey and a.fyearq = b.fyear and a.fqtr=b.fqtr ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 23528 rows and 315 columns.

1253  
1254  create table Analysis as
1255  select  a.*, b.*
1256  from    Analysis as a left join io_class as b
1257  on      a.gvkey=b.gvkey and a.fyearq=b.ryear and a.fqtr=b.rqtr ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
WARNING: Variable gvkey already exists on file WORK.ANALYSIS.
WARNING: Variable permno already exists on file WORK.ANALYSIS.
WARNING: Variable rdate already exists on file WORK.ANALYSIS.
WARNING: Variable ryear already exists on file WORK.ANALYSIS.
NOTE: Table WORK.ANALYSIS created, with 23528 rows and 324 columns.

1258  
1259  create table Analysis as
1260  select  a.*, b.kzindex,b.saindex,b.wwindex
1261  from    Analysis as a left join constraints as b
1262  on      a.gvkey=b.gvkey and a.fyearq=b.fyear+1 ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 23528 rows and 327 columns.

1263  create table Analysis as
1264  select  a.*, b.abvolume, b.volumeturn
1265  from    Analysis as a left join abvolume as b
1266  on      a.gvkey=b.gvkey and a.fyearq=b.fyearq and a.fqtr=b.fqtr;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 23528 rows and 329 columns.

1267  
1268  create table Analysis as
1269  select  a.*, b.*
1270  from    Analysis as a left join retvol as b
1271  on      a.gvkey=b.gvkey and a.rdq=b.enddt;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
WARNING: Variable gvkey already exists on file WORK.ANALYSIS.
NOTE: Table WORK.ANALYSIS created, with 23528 rows and 335 columns.

1272  
1273  create table Analysis as
1274  select  a.*, b.car_meeting00
1275  from    Analysis as a left join car_meetingdt1 as b
1276  on      a.gvkey=b.gvkey and a.pairid=b.pairid  ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 23528 rows and 336 columns.

1277  
1278  create table Analysis as
1279  select  a.*, b.car_meeting01
1280  from    Analysis as a left join car_meetingdt2 as b
1281  on      a.gvkey=b.gvkey and a.pairid=b.pairid  ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 23528 rows and 337 columns.

1282  
1283  create table Analysis as
1284  select  a.*, b.car_meeting11
1285  from    Analysis as a left join car_meetingdt3 as b
1286  on      a.gvkey=b.gvkey and a.pairid=b.pairid  ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 23528 rows and 338 columns.

1287  
1288  create table Analysis as
1289  select  a.*, b.car_meeting17
1290  from    Analysis as a left join car_meetingdt4 as b
1291  on      a.gvkey=b.gvkey and a.pairid=b.pairid  ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 23528 rows and 339 columns.

1292  
1293  create table Analysis as
1294  select  a.*, b.car_meeting27
1295  from    Analysis as a left join car_meetingdt5 as b
1296  on      a.gvkey=b.gvkey and a.pairid=b.pairid  ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 23528 rows and 340 columns.

1297  
1298  create table Analysis as
1299  select  a.*, b.car_meeting214
1300  from    Analysis as a left join car_meetingdt6 as b
1301  on      a.gvkey=b.gvkey and a.pairid=b.pairid  ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 23528 rows and 341 columns.

1302  
1303  
1304  create table Analysis as
1305  select  a.*, b.*
1306  from    Analysis as a left join AFERR as b
1307  on      a.gvkey=b.gvkey and
1308          year(a.datadate)=year(b.FPEDATS);
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
WARNING: Variable gvkey already exists on file WORK.ANALYSIS.
NOTE: Table WORK.ANALYSIS created, with 23528 rows and 353 columns.

1309  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           10.62 seconds
      cpu time            10.18 seconds
      

1310  proc sort data=Analysis nodupkey; by cid gvkey rdq; run;

NOTE: There were 23528 observations read from the data set WORK.ANALYSIS.
NOTE: 42 observations with duplicate key values were deleted.
NOTE: The data set WORK.ANALYSIS has 23486 observations and 353 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.36 seconds
      cpu time            0.37 seconds
      

1311  
1312  * other datasets;
1313  proc sql;
1314  create table Analysis as
1315  select  a.*, b.*
1316  from    Analysis as a left join mfor_13d as b
1317  on      a.gvkey=b.gvkey and a.CAMPAIGN_ID=b.CAMPAIGN_ID ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
WARNING: Variable gvkey already exists on file WORK.ANALYSIS.
WARNING: Variable campaign_id already exists on file WORK.ANALYSIS.
NOTE: Table WORK.ANALYSIS created, with 23486 rows and 361 columns.

1318  
1319  create table Analysis as
1320  select  a.*, b.*
1321  from    Analysis as a left join advisory as b
1322  on      a.CAMPAIGN_ID=b.CAMPAIGN_ID ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
WARNING: Variable CAMPAIGN_ID already exists on file WORK.ANALYSIS.
NOTE: Table WORK.ANALYSIS created, with 23486 rows and 372 columns.

1323  
1324  create table Analysis as
1325  select  a.*,
1326          b.ir_freq, b.ir_dum, b.ir_freq_ann, b.ir_max,
1327          b.ir_sic2, b.ir_std_sic2, b.ir_sic2_ann,
1328          b.ir_avg, b.ir_std, b.ir_min, b.ir_max,
1329          b.ir_avg_last4, b.ir_std_last4,
1330          b.ir_avg_last8, b.ir_std_last8,
1331          b.ir_avg_last12, b.ir_std_last12,
1332          b.ir_avg_last16, b.ir_std_last16,
1333          b.ir_freq_movave4, b.ir_freq_movave8, b.ir_freq_movave12, b.ir_freq_movave16,
1334          b.ir_freq_movstd4, b.ir_freq_movstd8, b.ir_freq_movstd12, b.ir_freq_movstd16
1335  from    Analysis as a left join ir as b
1336  on      a.gvkey=b.gvkey and
1337          year(a.rdq)=b.year and qtr(a.rdq)=b.quarter;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
WARNING: Variable ir_max already exists on file WORK.ANALYSIS.
NOTE: Table WORK.ANALYSIS created, with 23486 rows and 398 columns.

1338  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           3.14 seconds
      cpu time            3.01 seconds
      

1339  proc sort data=Analysis nodupkey; by cid gvkey rdq; run;

NOTE: There were 23486 observations read from the data set WORK.ANALYSIS.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.ANALYSIS has 23486 observations and 398 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.46 seconds
      cpu time            0.45 seconds
      

1340  
1341  * drop unwanted vars;
1342  data Analysis ;
1343      set Analysis;
1344      drop outcome_desc company_fee_desc dissident_fee_desc dir_off_own_desc
1344! campaign_synopsis campaign_title iso_country
1345      target: actfinanc: actlegal: actpr: ;
1346  run;

NOTE: There were 23486 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.ANALYSIS has 23486 observations and 354 variables.
NOTE: DATA statement used (Total process time):
      real time           0.19 seconds
      cpu time            0.20 seconds
      

1347  
1348  * Export data to Stata file;
1349  proc export data = Analysis outfile = &FFP. replace;
1349!                                                      run;

NOTE: The export data set has 23486 observations and 354 variables.
NOTE: "C:\Users\hpham13\Projects\mf_activism\empirical\1_code\final_package_acceptance\assembledd
      ata_aum_p95_2.dta" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           0.19 seconds
      cpu time            0.17 seconds
      

1350  
1351  proc printto;
1352  run;

